package com.wlm.controller;

import com.wlm.Utils.ResultUtil;
import com.wlm.Utils.ResultVo;
import com.wlm.dto.rep.FormDto;
import com.wlm.dto.rep.UserDto;
import com.wlm.entity.Form;
import com.wlm.entity.User;
import com.wlm.entity.model.ResultFormat;
import com.wlm.service.FormService;
import com.wlm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("form")
public class FormController {

    @Autowired
    private FormService formService;

    /**
     * 表单登陆
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ResultFormat addForm(@RequestBody FormDto formDto) {
        Integer result = formService.addForm(formDto);
        if (result == 1) {
            return  ResultUtil.success(200, "提交成功");
        } else {
            return  ResultUtil.error(201, "失败");
        }

    }


    /**
     * 表单登陆
     */
    @RequestMapping(value = "/queryForm", method = RequestMethod.POST)
    public ResultFormat queryForm(@RequestBody FormDto formDto) {
        FormDto dto = formService.queryForm(formDto);
        return  ResultUtil.success(dto);
    }
    /**
     * 表单登陆
     */
    @RequestMapping(value = "/add1", method = RequestMethod.POST)
    public ResultFormat addForm1(FormDto formDto) {
        Integer result = formService.addForm(formDto);
        return  ResultUtil.success(200, "提交成功");
    }




}
